package com.food.controller;

import com.food.entity.LayuiR;
import com.food.entity.po.FoodApiGd;
import com.food.entity.po.FoodApiBaidu;
import com.food.entity.po.FoodApiTx;
import com.food.entity.vo.*;
import com.food.service.FoodShopService;
import com.food.utils.GenerateData;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author : 港某
 * @date : 2021/1/8 14:41
 */
@CrossOrigin
@RestController
@RequestMapping(value = "foodShopSearch")
public class FoodShopController {

    @Resource
    FoodShopService foodShopService;

    @Resource
    GenerateData generateData;

    @GetMapping(value = "getTime")
    String getTime() {
        Date databaseTime = foodShopService.getDatabaseTime();
        return databaseTime.toString();
    }

    @GetMapping(value = "generateData")
    void generateData() {
        generateData.generateData();
    }

    @GetMapping(value = "generateDataBaidu")
    void generateDataBaidu() {
        generateData.generateDataBaidu();
    }

    @GetMapping(value = "generateDataTx")
    void generateDataTx() {
        generateData.generateDataTx();
    }

    @PostMapping(value = "queryFoodShop")
    LayuiR<FoodApiGd> getFoodShop(FoodShopSearch foodShopSearch) {
        return foodShopService.getFoodShop(foodShopSearch);
    }

    @PostMapping(value = "queryFoodShopBaidu")
    LayuiR<FoodApiBaidu> getFoodShopBaidu(FoodShopSearch foodShopSearch) {
        return foodShopService.getFoodShopBaidu(foodShopSearch);
    }

    @PostMapping(value = "queryFoodShopTx")
    LayuiR<FoodApiTx> getFoodShopTx(FoodShopSearch foodShopSearch) {
        return foodShopService.getFoodShopTx(foodShopSearch);
    }

    @RequestMapping(value = "queryFoodPie1", method = {RequestMethod.POST, RequestMethod.GET})
    List<Pie> getPieCount1() {
        return foodShopService.getPieCount1();
    }

    @PostMapping(value = "queryFoodPie2")
    List<Pie> getPieCount2() {
        return foodShopService.getPieCount2();
    }

    @PostMapping(value = "queryFoodPie3")
    List<Pie> getPieCount3() {
        return foodShopService.getPieCount3();
    }

    @PostMapping(value = "queryFoodPie4")
    List<PieDouble> getPieCount4() {
        return foodShopService.getPieCount4();
    }

    @PostMapping(value = "queryFoodPie5")
    List<PieDouble> getPieCount5() {
        return foodShopService.getPieCount5();
    }

    @PostMapping(value = "queryFoodPie6")
    List<Pie> getPieCount6() {
        return foodShopService.getPieCount6();
    }

    @PostMapping(value = "queryFoodPie7")
    List<PieDouble> getPieCount7() {
        return foodShopService.getPieCount7();
    }

    @PostMapping(value = "queryFoodBar1")
    List<Pie> getBarCount1() {
        return foodShopService.getBarCount1();
    }

    @PostMapping(value = "queryFoodBar2")
    List<Bar> getBarCount2() {
        return foodShopService.getBarCount2();
    }

    @PostMapping(value = "queryHeatMap")
    List<HeatMap> getHeatMap() {
        return foodShopService.getHeatMap();
    }

    @PostMapping(value = "queryFoodSun1")
    List<Sun> getSunCount1() {
        return foodShopService.getSunCount1();
    }

    @PostMapping(value = "queryFoodSun2")
    List<Sun> getSunCount2() {
        return foodShopService.getSunCount2();
    }

}
